package com.cashmama.market.api.domain.service.actions;

import com.cashmama.market.api.domain.enums.UserProfileActionEnum;
import com.cashmama.market.api.domain.enums.UserProfileActionStatusEnum;
import com.cashmama.market.api.domain.service.ApiUserCenterService;
import com.cashmama.market.api.infras.enums.JumpRouterEnum;
import com.qianli.cashmama.product.facade.result.AppConfig;
import com.qianli.user.ro.auth.UserAuthStatusRO;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created with IntelliJ IDEA.
 * User: yujianfu (mr.vencnet@gmail.com)
 * Date: 2019-12-24
 * Time: 14:47
 */
//@Service
public class AdvanceAction extends BaseAction {

//    @PostConstruct
//    public void init() {
//        ActionListService.actionListHandler.put(ActionTypeEnums.ADVANCE, this);
//    }

    @Autowired
    private ApiUserCenterService apiUserCenterService;


    @Override
    public ActionDetailVo getAction(String userCode, AppConfig appConfig, UserAuthStatusRO userAuthStatus) {

        ActionDetailVo actionDetailVo = new ActionDetailVo()
                .setIconUrl(appConfig.getKycDocumentsLightIconUrl())
                .setTitle(UserProfileActionEnum.ADVANCE.getTitle())
                .setStatus(0)
                .setEnableToClick(true)
                .setJumpUrl(JumpRouterEnum.PERSONAL_ADVANCE.getJumpUrl())
                .setStatusText(UserProfileActionStatusEnum.NOT_FILLED.getDesc());

        Boolean complete = apiUserCenterService.advanceAadhaarActionComplete(userCode);

        if (complete) {
            actionDetailVo.setEnableToClick(false).setStatus(1)
                    .setStatusText(UserProfileActionStatusEnum.AUTHORIZED.getDesc());
        }

        return actionDetailVo;
    }

}
